package com.sh.data.engine.domain.normalization.modeldesign.model.service;

import com.sh.data.engine.domain.base.model.PageResult;
import com.sh.data.engine.domain.normalization.modeldesign.model.model.domain.*;
import com.sh.data.engine.domain.normalization.modeldesign.model.model.param.ExternalSaveModelParam;
import com.sh.data.engine.domain.normalization.modeldesign.model.model.param.SaveFieldParam;
import com.sh.data.engine.domain.normalization.modeldesign.model.model.param.SaveModelParam;
import com.sh.data.engine.domain.normalization.research.themedesign.model.domain.ThemeDomain;
import com.sh.data.engine.domain.normalization.standard.model.domain.DictionaryDomain;
import com.sh.data.engine.repository.dao.dataasset.entity.TblPropEntity;

import java.util.List;
import java.util.Map;

/**
 * @author : changkong
 * @date : 2022/1/17
 */
public interface ModelService {

    StorageDomain getStorageType(Long projectId);

    List<ThemeDomain> getThemesByProjectId(Long projectId, String modelType);

    List<ThemeDomain> getMenuByProjectId(Long projectId, String modelType);

    Map<Long, TblPropEntity> getModelIdTblMap(List<Long> modelIds);

    List<DictionaryDomain> getDictionaryList(Long projectId);

    PageResult<ModelListDomain> getTablePage(
        Integer pageNum, Integer pageSize, List<String> modelType, String search);

    List<ModelListDomain> getTableList(List<String> modelType, String search, Long themeId);

    PageResult<ModelListDomain> getTablePageByThemeId(
        Integer pageNum, Integer pageSize, Long themeId, List<String> namesByType, String search);

    ModelDomain getSimpifyModelById(Long projectId, Long id);

    ModelDomain getModelById(Long projectId, Long id);

    ModelDomain getModelIdByTblId(Long projectId, long tblId);

    ModelDomain getModelByTblId(Long projectId, long tblId);

    ModelDomain getModelByName(Long projectId, String schema, String tableName);

    boolean externalSaveNewModel(ExternalSaveModelParam externalSaveModelParam);

    boolean saveNewModel(SaveModelParam saveNewModelParam);

    boolean deleteModelById(Long modelId);

    List<ModelIdNameDomain> getModelListByType(Long themeId, String type);

    void saveNewField(SaveFieldParam saveFieldParam);

    /**
     * description 返回主题id返回所有model
     *
     * @return
     * @author : mingxi.xpb
     * @date : 2022/1/21 16:00
     */
    List<TblPropEntity> getAllModelByThemeId(Long themeId);

    /**
     * description 根据主题idList返回所有model
     *
     * @author : mingxi.xpb
     * @date : 2022/1/21 17:10
     */
    List<ModelAllFieldsDomain> getAllModelByThemeIdList(List<Long> themeIdList);

    void saveModel(SaveModelParam saveModelParam);

    //  List<DataStandardTblRelationDomain> getRelationByForeignTblId(Long projectId, Long tblId);

    ModelDomain getTblPropById(Long projectId, Long tblPropId);

    List<String> getSchemas(Long projectId);

    List<ModelListDomain> searchTable(String tableName);

    Long getTableDataSecretLevelByModelId(Long modelId);
}
